{{! 输出子菜单 }}
{{#*inline "getMenuChildren"}}
    {{#each appMenuItems as |appMenuItem|}}
    {{#unless @first}}, {{/unless}}{
        "id": "{{system.deploySysId}}-{{appItem.codeName}}-{{appMainMenu.codeName}}-{{appMenuItem.opt.id}}",
        "code_name": "{{appMenuItem.opt.id}}",
        "display_name": "{{appMenuItem.opt.caption}}",
        "parent_id": "{{system.deploySysId}}-{{appItem.codeName}}-{{appMainMenu.codeName}}-{{parentMenuItem.name}}",
        "router_path": "",
        "sort": {{@index}},
        "description": ""
        {{#if appMenuItem.opt.pSAppFunc}}
        ,"func": {
            "menu_id": "{{system.deploySysId}}-{{appItem.codeName}}-{{appMainMenu.codeName}}-{{appMenuItem.opt.id}}",
            "id": "{{appMenuItem.opt.pSAppFunc.id}}",
            "display_name": "{{appMenuItem.opt.pSAppFunc.name}}",
            "component_id": "{{appMenuItem.appMenu.app.system.deploySysId}}-{{appMenuItem.appMenu.app.codeName}}-{{appMenuItem.opt.pSAppFunc.pSAppView.codeName}}"
        }
        {{/if}}
        {{#if appMenuItem.appMenuItems}}
        ,"children":[{{>getMenuChildren appItem=appItem appMainMenu=appMainMenu appMenuItems=appMenuItem.appMenuItems parentMenuItem=appMenuItem}}]
        {{/if}}
    }
    {{/each}}
{{/inline}}
{{! 开始输出 }}
{
    "id": "{{system.deploySysId}}",
    "system_id": "{{system.deploySysId}}",
    "display_name": "{{system.name}}",
    "menus": [
        {{#each system.apps as |app|}}{{#unless @first}},{{/unless}}
        {{#each app.appMenus as |appMenu|}}{{#unless @first}},{{/unless}}
        {{#each appMenu.appMenuItems as |appMenuItem|}}{{#unless @first}},{{/unless}}
        {
            "id": "{{system.deploySysId}}-{{app.codeName}}-{{appMenu.codeName}}-{{appMenuItem.name}}",
            "code_name": "{{appMenuItem.name}}",
            "display_name": "{{appMenuItem.opt.caption}}",
            "parent_id": "0",
            "router_path": "",
            "sort": {{@index}},
            "description": ""
            {{#if appMenuItem.opt.pSAppFunc}}
            ,"func": {
                "menu_id": "{{system.deploySysId}}-{{app.codeName}}-{{appMenu.codeName}}-{{appMenuItem.opt.id}}",
                "id": "{{appMenuItem.opt.pSAppFunc.id}}",
                "display_name": "{{appMenuItem.opt.pSAppFunc.name}}",
                "component_id": "{{appMenuItem.appMenu.app.system.deploySysId}}-{{appMenuItem.appMenu.app.codeName}}-{{appMenuItem.opt.pSAppFunc.pSAppView.codeName}}"
            }
            {{/if}}
            {{#if appMenuItem.appMenuItems}}
                ,"children":[{{>getMenuChildren appItem=app appMainMenu=appMenu appMenuItems=appMenuItem.appMenuItems parentMenuItem=appMenuItem}}]
            {{/if}}
        }
        {{/each}}
        {{/each}}
        {{/each}}
    ],
    "components": [
        {{#each system.apps}}{{#unless @first}},{{/unless}}
        {{#each router.components as |comItem|}}{{#unless @first}},{{/unless}}
        {
            "id": "{{comItem.id}}",
            "code_name": "{{comItem.pathCodeName}}",
            "display_name": "{{#if comItem.name}}{{replace comItem.name '【行为】' ''}}{{else}}{{comItem.opt.codeName}}{{/if}}",
            "component_type": "{{comItem.type}}",
            "parent_id": "{{#if comItem.parent}}{{comItem.parent.id}}{{/if}}",
            "router_path": {{#if comItem.pathCodeName}}"{{#if opt.psAppDataEntity}}{{pluralize opt.psAppDataEntity.codeName}}/:{{lowerCase opt.psAppDataEntity.codeName}}?/{{/if}}{{lowerCase pathCodeName}}/:{{lowerCase pathCodeName}}?"{{else}}null{{/if}},
            "sort": {{@index}},
            "description": ""
            {{#if comItem.apis}}
            ,"apis": [
            {{#each comItem.apis as |comapi| }}
                {{#unless @first}},{{/unless}}{
                "component_id": "{{comItem.id}}",
                "api_operation_id": "{{system.deploySysId}}-{{comapi}}"
                }
            {{/each}}
            ]
            {{/if}}
        }
        {{/each}}
        {{/each}}
        {{#if system.allPSSysUniReses}}
        ,
        {
            "id": "{{system.deploySysId}}-UNIRES",
            "code_name": "{{system.deploySysId}}-UNIRES",
            "display_name": "统一资源",
            "component_type": "UNIRES",
            "parent_id": "",
            "router_path": null,
            "sort": 91000,
            "description": ""
        }
        {{#each system.allPSSysUniReses as |unires|}}
        ,
        {
            "id": "{{system.deploySysId}}-{{unires.resCode}}",
            "code_name": "{{unires.resCode}}",
            "display_name": "{{unires.name}}",
            "component_type": "UNIRES",
            "parent_id": "{{system.deploySysId}}-UNIRES",
            "router_path": null,
            "sort": {{@index}},
            "description": ""
        }
        {{/each}}
        {{/if}}
    ],
    "apis": [
        {{#each system.allApiEntities as |apiEntity|}}{{#unless @first}}, {{/unless}}
        {
            "id": "{{system.deploySysId}}-{{apiEntity.entity.codeName}}",
            "code_name": "{{apiEntity.entity.codeName}}",
            "tags": "{{apiEntity.entity.logicName}}",
            "base_path": "/{{pluralize apiEntity.entity.opt.codeName}}",
            "description": "",
            "operations": [
                {{#each apiEntity.methods as |apiMethod|}}{{#unless parentApiEntities}}{{#neq apiMethod.methodName "Select"}}
                {{#unless @first}}, {{/unless}}{
                    "id": "{{system.deploySysId}}-{{apiEntity.entity.codeName}}-{{apiMethod.methodName}}",
                    "code_name": "{{apiMethod.methodName}}",
                    "api_id": "{{system.deploySysId}}-{{apiEntity.entity.codeName}}",
                    "path": "{{apiMethod.requestPath2}}",
                    "notes": "{{apiMethod.apiName}}",
                    "description": "",
                    "scopes": [
                        {{#each apiEntity.entity.dataScopes as |scope|}}{{#unless @first}}, {{/unless}}
                        {
                            "id":"{{system.deploySysId}}-{{apiEntity.entity.codeName}}-{{apiMethod.methodName}}-{{scope.id}}",
                            "code_name": "{{scope.id}}",
                            "display_name": "{{scope.name}}"
                        }
                        {{/each}}
                    ]
                }
                {{/neq}}
                {{/unless}}
                {{/each}}
            ]
        }
        {{/each}}
    ]
}
